<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>Thymeleaf的入门</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>
<body>
<!--输出hello数据-->
<p th:text="${hello}"></p>
<!--普通文本输出-->
<p th:text="${description}"></p>
<!--输出文本可识别html标签-->
<p th:utext="${description}"></p>
<!--遍历数据 th:each -->
<table>
    <tr>
        <td>下标</td>
        <td>编号</td>
        <td>姓名</td>
        <td>住址</td>
    </tr>
    <tr th:each="user,userStart:${userList}">
        <td>
            下标:<span th:text="${userStart.index}"></span>
        </td>
        <td th:text="${user.id}"></td>
        <td th:text="${user.name}"></td>
        <td th:text="${user.address}"></td>
    </tr>
</table>
<!--date时间-->
<div>
    <span th:text="${#dates.format(nowDate,'yyyy-MM-dd HH:mm:ss')}"></span>
</div>
<!--if判断-->
<div>
    <span th:if="${age>=18}">
        成年人!
    </span>
    <span th:if="${age<18}">
        未成年人!
    </span>
<!--  反向判断 unless==>如果不  -->
    <span th:unless="${age<18}">
        年龄不是小于18岁的,所以是成年人!
    </span>
</div>

<!--遍历map th:each-->
<div th:each="map,mapStart:${dataMap}">
    <div th:text="${map}"></div>
    key:<span th:text="${mapStart.current.key}"></span><br/>
    value:<span th:text="${mapStart.current.value}"></span><br/>
    =================================
</div>
<!--字符串处理-->
<p>判断是都以spec_开始,如果是,则输出name的值</p>
<div th:if="${#strings.startsWith(name,'spec_')}">
    <span th:text="${name}"></span>
</div>

<p>将name中的spec_替换成空数据</p>
<div th:text="${#strings.replace(name,'spec_','')}">
    <span th:text="${name}"></span>
</div>

<p>跳转地址</p>
<a th:href="@{${url}(name='玛尔扎哈',address='深圳')}">跳转到test/add方法</a>
</body>

<p>图片显示</p>
<img th:src="'http://www.itheima.com/images/logo.png'">

<p>输出1~10之间的数据</p>
<div th:each="i:${#numbers.sequence(1,10,1)}">
    <span th:text="${i}"></span>
</div>
</html>